package com.yserp.project.erp.bill.receivemoney.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yserp.common.utils.mybatis.MybatisPlusUtil;
import com.yserp.project.erp.bill.receivemoney.domain.ReceiveMoneyItem;
import com.yserp.project.erp.bill.receivemoney.mapper.ReceiveMoneyItemMapper;
import com.yserp.project.erp.bill.receivemoney.service.IReceiveMoneyItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 收款单Service业务层处理
 *
 * @author yserp
 * @date 2022-08-11
 */
@Service
public class ReceiveMoneyItemServiceImpl extends ServiceImpl<ReceiveMoneyItemMapper, ReceiveMoneyItem> implements IReceiveMoneyItemService {
    @Resource
    private ReceiveMoneyItemMapper receiveMoneyItemMapper;


    /**
     * 查询收款单列表
     *
     * @param receiveMoneyItem 收款单
     * @return 收款单
     */
    @Override
    public List<ReceiveMoneyItem> selectReceiveMoneyItemList(ReceiveMoneyItem receiveMoneyItem) {
        QueryWrapper<ReceiveMoneyItem> queryWrapper = new QueryWrapper<>();
        MybatisPlusUtil.notNullField(receiveMoneyItem,queryWrapper);
        return receiveMoneyItemMapper.selectList(queryWrapper);
    }

    @Override
    public List<ReceiveMoneyItem> selectReceiveMoneyItemListByMainId(Long mainId) {
        ReceiveMoneyItem receiveMoneyItem = new ReceiveMoneyItem();
        receiveMoneyItem.setMainId(mainId);
        return this.selectReceiveMoneyItemList(receiveMoneyItem);
    }


}
